home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_091 / misc / adldebug.c next >
C/C++ Source or Header  |  1992-05-06  |  16KB  |  721 lines

  1. #if UNIX
  2. #  include <signal.h>
  3. #endif
  4. #include <ctype.h>
  5. #include <stdio.h>
  6. #include <fcntl.h>
  7.  
  8. #include "adltypes.h"
  9. #include "adlprog.h"
  10. #include "adldef.h"
  11. #include "vstring.h"
  12. #include "virtmem.h"
  13.  
  14. #define NUMCODE    (hdr.codeindex.numobjs * 512)
  15.  
  16. #undef max
  17. #undef min
  18. #define max(a,b) (a > b ? a : b)
  19. #define min(a,b) (a < b ? a : b)
  20.  
  21. char
  22.     *inname;            /* Input file name            */
  23. int
  24.     infile;            /* Input file                */
  25.  
  26. struct pagetab
  27.     codetab;            /* Virtual memory table            */
  28.  
  29. address
  30.     *sortedrouts,        /* Sorted list of routine entry points    */
  31.     bot, top;            /* Beginning and ending of action range    */
  32. int16
  33.     blocked,            /* Semaphore for breaker        */
  34.     was_signaled,        /* Were we signaled?            */
  35.     my_nums;            /* Temporary for virtual strings    */
  36. struct symbol
  37.     *symtab;            /* Symbol table                */
  38.  
  39. struct    header        hdr;        /* Actual header        */
  40. struct    verbrec        *verbspace;    /* Verb contents        */
  41. struct    objrec        *objspace;    /* Object contents        */
  42. struct    preprec        *prepspace;    /* Preposition contents        */
  43. struct    vp_syn        *verbsyn;    /* Verb synonyms        */
  44. int16            *varspace;    /* Stack & variables        */
  45. int16            *nounspace;    /* Noun indices            */
  46. address            *routspace;    /* Routine indexes        */
  47. int32            *str_tab;    /* String table            */
  48.  
  49. char
  50.     *malloc();            /* Memory allocator            */
  51.  
  52. main( argc, argv )
  53. int
  54.     argc;
  55. char
  56.     *argv[];
  57. {
  58.     if( argc != 2 ) {
  59.     /* Too few command line arguments */
  60.     printf( "Usage: %s dungeon.\n", argv[ 0 ] );
  61.     exit( -1 );
  62.     }
  63.     inname = argv[ 1 ];        /* Save the input file name        */
  64.     init();            /* Initialize the structures        */
  65.     adldebug();            /* Do the debugging            */
  66. }
  67.  
  68.  
  69. init()
  70. {
  71.     int
  72.     breaker();        /* Signal catcher        */
  73.  
  74.     /* Open the file */
  75.     if( (infile = open( inname, RB )) < 0 ) {
  76.     printf( "Error opening file %s\n", inname );
  77.     exit( -1 );
  78.     }
  79.  
  80.     /* Read the header structure */
  81.     lseek( infile, 0L, 0 );
  82.     read( infile, &hdr, sizeof( struct header ) );
  83.     if( hdr.magic != M_ADL ) {
  84.     printf( "%s : not an ADL datafile.\n", inname );
  85.     exit( -1 );
  86.     }
  87.  
  88.     /* Load the arrays of things */
  89.     loadarray( &varspace,    &hdr.varindex );
  90.     NUMROUT++;
  91.     loadarray( &routspace,    &hdr.routindex );
  92.     NUMROUT--;
  93.     loadarray( &symtab,        &hdr.symindex );
  94.     loadarray( &verbspace,    &hdr.verbindex );
  95.     loadarray( &objspace,    &hdr.objindex );
  96.     loadarray( &nounspace,    &hdr.nounindex );
  97.     loadarray( &str_tab,    &hdr.strtabindex );
  98.  
  99.     /* Initialize the virtual memory routines */
  100.     vsinit( infile, hdr.strindex.ptr, 1, (char *)NULL, (char *)NULL, &my_nums,
  101.         str_tab );
  102.     vm_init( infile, hdr.codeindex.ptr, &codetab, 0 );
  103.  
  104.     /* Print the copyright messages */
  105.     fputs( "ADL debugger - Version 2.1 - April 28, 1987\n", stderr );
  106.     fputs( "Copyright 1985, 1986, 1987 by Ross Cunniff\n", stderr );
  107.     fputs( "All rights reserved.\n", stderr );
  108.     fflush( stderr );
  109.  
  110.     /* Sort the routine entry points, and decode the symbol table */
  111.     sortrouts();
  112.     sym_decode();
  113.  
  114.     /* All done.  Print the prompt and enable the break catcher. */
  115.     fputs( "Type ? for help.\n", stderr );
  116.     fflush( stderr );
  117. }
  118.  
  119.  
  120. loadarray( a, d )
  121. char    **a;
  122. struct    adldir *d;
  123. {
  124.     if( d->numobjs * d->objsize ) {
  125.     lseek( infile, d->ptr, 0 );
  126.     *a = malloc( d->numobjs * d->objsize );
  127.     if( *a == (char *)0 ) {
  128.         fprintf( stderr, "Out of memory.\n" );
  129.         exit( -1 );
  130.     }
  131.     read( infile, *a, d->numobjs * d->objsize );
  132.     }
  133. }
  134.  
  135.  
  136. sortrouts()
  137. {
  138.     int16
  139.     i, j;            /* Loop counters            */
  140.     char
  141.     *used;
  142.  
  143.     /* Tell the user what we're doing */
  144.     fputs( "Sorting routines...", stderr );
  145.     fflush( stderr );
  146.  
  147.     /* Get memory for the sorted routines and zero it out */
  148.     sortedrouts = (address *)malloc( sizeof( int16 ) * (NUMROUT + 1) );
  149.     used = malloc( sizeof( char ) * (NUMROUT + 1) );
  150.     if( (sortedrouts == (address *)0) || (used == (char *)0) ) {
  151.     fprintf( stderr, "Out of memory.\n" );
  152.     exit( -1 );
  153.     }
  154.  
  155.     for( i = 0; i <= NUMROUT; i++ )
  156.     used[ i ] = sortedrouts[ i ] = 0;
  157.  
  158.     /* Use a simple selection sort. (yeah, yeah, O(N**2), but I'm lazy) */
  159.     for( i = 1; i <= NUMROUT; i++ ) {
  160.     for( j = 0; j < NUMROUT; j++ ) {
  161.         if(        !used[ j ] &&
  162.         (routspace[ j ] > routspace[ sortedrouts[ NUMROUT - i ] ]) )
  163.         sortedrouts[ NUMROUT - i ] = j;
  164.     }
  165.     used[ sortedrouts[ NUMROUT - i ] ] = 1;
  166.     }
  167.  
  168.     routspace[ NUMROUT ] = NUMCODE + 1;
  169.  
  170.     /* All done! */
  171.     fputs( "Done.\n", stderr );
  172.     fflush( stderr );
  173.     sortedrouts[ NUMROUT ] = NUMROUT;
  174.     free( used );
  175. }
  176.  
  177.  
  178. sym_decode()
  179. {
  180.     int16
  181.     i, j;
  182.  
  183.     /* Tell the user what we're doing */
  184.     fputs( "Decoding symbol table...", stderr );
  185.     fflush( stderr );
  186.  
  187.     /* Un-encode the symbol table, by inverting each character */
  188.     for( i = 1; i < NUMSYM; i++ ) {
  189.     if( !*symtab[ i ].name ) {
  190.         /* This name is null - make it a question mark */
  191.         symtab[ i ].name[ 0 ] = '?';
  192.         symtab[ i ].name[ 1 ] = '\0';
  193.     }
  194.     else {
  195.         for( j = 0; symtab[ i ].name[ j ]; j++ )
  196.         symtab[ i ].name[ j ] ^= CODE_CHAR;
  197.     }
  198.     }
  199.  
  200.     /* All done! */
  201.     fputs( "Done.\n", stderr );
  202.     fflush( stderr );
  203. }
  204.  
  205.  
  206. breaker()
  207. {
  208.     if( !blocked ) {
  209.     blocked = was_signaled = 1;
  210.     puts( "\n" );
  211.     }
  212. }
  213.  
  214.  
  215. adldebug()
  216. {
  217.     int
  218.     prompt = 1;
  219.  
  220.     while( 1 ) {
  221.     was_signaled = 0;
  222.     blocked = 0;
  223.     if( prompt ) {
  224.         fflush( stdout );
  225.         fputs( "> ", stderr );
  226.         fflush( stderr );
  227.     }
  228.     prompt = 1;
  229.     switch( getchar() ) {
  230.         /* Execute the user's command */
  231.         case 'a' : eatEOL();          dumpsymbols( ADJEC );    break;
  232.         case 'd' : eatEOL();          dumpdir();        break;
  233.         case 'g' : getargs( 0, NUMVAR - 1 );  dumpglobs();        break;
  234.         case 'i' : getargs( 1, NUMCODE - 1 ); dumpinstr();        break;
  235.         case 'm' : getargs( 1, NUMSTR - 1 );  dumpstrings();    break;
  236.         case 'n' : getargs( 0, NUMNOUN - 1 ); dumpnouns();        break;
  237.         case 'o' : getargs( 0, NUMOBJ - 1 );  dumpobjs();        break;
  238.         case 'r' : getargs( 1, NUMROUT - 1 ); dumprouts();        break;
  239.         case 's' : getargs( 0, NUMSYM - 1 );  dumpsymbols( 0 );    break;
  240.         case 'v' : getargs( 0, NUMVERB - 1 ); dumpverbs();        break;
  241.         case '?' : eatEOL();          dohelp();        break;
  242.         case EOF :
  243.         case 'q' : exit( 0 );
  244.         case '\t':
  245.         case ' ' : prompt = 0;
  246.         case '\n': break;
  247.         default  : eatEOL();          puts( "\007" );
  248.     }
  249.     }
  250. }
  251.  
  252.  
  253. eatEOL()
  254. {
  255.     while( getchar() != '\n' )
  256.     /* NOTHING */;
  257. }
  258.  
  259.  
  260. getargs( lower, upper )
  261. address
  262.     lower, upper;
  263. {
  264.     int
  265.     ch;
  266.  
  267.     bot = top = 0;
  268.     ch = eatwhite( ' ' );
  269.     if( ch == '$' ) {
  270.     bot = upper;
  271.     ch = mygetchar();
  272.     }
  273.     else
  274.     while( isdigit( ch ) ) {
  275.         bot = 10L * bot + (ch - '0');
  276.         ch = mygetchar();
  277.     }
  278.     bot = min( max( bot, lower), upper );
  279.     ch = eatwhite( ch );
  280.     if( ch == '\n' ) {
  281.     top = bot;
  282.     return;
  283.     }
  284.     else if( ch != '-' ) {
  285.     top = bot - 1;
  286.     while( ch != '\n' )
  287.         ch = mygetchar();
  288.     return;
  289.     }
  290.  
  291.     ch = eatwhite( ' ' );
  292.     if( ch == '$' )
  293.     top = upper;
  294.     else
  295.     while( isdigit( ch ) ) {
  296.         top = 10L * top + (ch - '0');
  297.         ch = mygetchar();
  298.     }
  299.     top = min( max( top, lower ), upper );
  300.     while( ch != '\n' )
  301.     ch = mygetchar();
  302. }
  303.  
  304.  
  305. mygetchar()
  306. {
  307.     int
  308.     ch;
  309.  
  310.     if( (ch = getchar()) == EOF )
  311.     exit( 0 );
  312.     return ch;
  313. }
  314.  
  315.  
  316. eatwhite( ch )
  317. int
  318.     ch;
  319. {
  320.     while( (ch == ' ') || (ch == '\t') )
  321.     ch = mygetchar();
  322.     return ch;
  323. }
  324.  
  325.  
  326. dumpsymbols( t )
  327. int16
  328.     t;
  329. {
  330.     int
  331.     i;
  332.     char
  333.     *print_type();
  334.  
  335.     if( t ) {
  336.     bot = 1; top = NUMSYM - 1;
  337.     }
  338.     for( i = bot; i <= top; i++ ) {
  339.     checkbreak( breaker );
  340.     if( was_signaled )
  341.         return;
  342.     if( t && symtab[ i ].type != t )
  343.         continue;
  344.     printf( "symtab[ %4d ].type = %s .val = %4d, .name = \"%s\"\n", i,
  345.         print_type( symtab[ i ].type ),
  346.         symtab[ i ].val, symtab[ i ].name );
  347.     }
  348. }
  349.  
  350.  
  351. char *
  352. print_type( type )
  353. int
  354.     type;
  355. {
  356.     switch( type ) {
  357.     case NOUN     : return "NOUN,    ";
  358.     case VERB     : return "VERB,    ";
  359.     case ADJEC    : return "ADJEC,   ";
  360.     case PREP     : return "PREP,    ";
  361.     case ROUTINE  : return "ROUTINE, ";
  362.     case STRING   : return "STRING,  ";
  363.     case CONST    : return "CONST,   ";
  364.     case VAR      : return "GLOBAL,  ";
  365.     case ARGUMENT : return "ARGUMENT,";
  366.     case NOUN_SYN : return "NOUN_SYN,";
  367.     case ARTICLE  : return "ARTICLE, ";
  368.     default      : return "UNKNOWN, ";
  369.     }
  370. }
  371.  
  372.  
  373. dumpdir()
  374. {
  375.     printf( "File name is %s\n", inname );
  376.     printf( "ADL id is %d\n", hdr.adlid );
  377.     printf( "%8d bytes in instructions\n",
  378.       hdr.codeindex.numobjs * hdr.codeindex.objsize );
  379.     printf( "%8ld bytes in messages\n\n",
  380.       (int32)((int32)hdr.strindex.numobjs * (int32)hdr.strindex.objsize ) );
  381.     printf( "%8d bytes in %8d string table entries\n",
  382.       4*hdr.strtabindex.numobjs, hdr.strtabindex.numobjs );
  383.     printf( "%8d bytes in %8d symbols",
  384.      NUMSYM*hdr.symindex.objsize, NUMSYM );
  385.     printf( " (%d legal)\n", find_leg() );
  386.     printf( "%8d bytes in %8d verbs\n",
  387.     NUMVERB*hdr.verbindex.objsize, NUMVERB );
  388.     printf( "%8d bytes in %8d objects\n", NUMOBJ*hdr.objindex.objsize, NUMOBJ );
  389.     printf( "%8d bytes in %8d nouns\n",
  390.     NUMNOUN*hdr.nounindex.objsize, NUMNOUN );
  391.     printf( "%8d bytes in %8d routines\n",
  392.     NUMROUT*hdr.routindex.objsize,NUMROUT);
  393.     printf( "%8d bytes in %8d globals\n",
  394.     NUMVAR * hdr.varindex.objsize, NUMVAR );
  395.     printf( "%8d adjectives\n", findone( ADJEC ) );
  396.     printf( "%8d articles\n", findone( ART ) );
  397. }
  398.  
  399.  
  400. find_leg()
  401. {
  402.     int
  403.     i, num_leg;
  404.  
  405.     num_leg = 0;
  406.     for( i = 0; i < NUMSYM; i++ )
  407.     if( *symtab[ i ].name != '?')
  408.         num_leg++;
  409.     return num_leg;
  410. }
  411.  
  412.  
  413. findone( type )
  414. int
  415.     type;
  416. {
  417.     int
  418.     i, num;
  419.  
  420.     num = 0;
  421.     for( i = 1; i < NUMSYM; i++ )
  422.     if( symtab[ i ].type == type )
  423.         num++;
  424.     return num;
  425. }
  426.  
  427.  
  428. dumpglobs()
  429. {
  430.     int
  431.     i;
  432.  
  433.     fputs( "Globals:\n", stdout );
  434.     for( i = bot; i <= top; i++ ) {
  435.     checkbreak( breaker );
  436.     if( was_signaled )
  437.         return;
  438.     printf( "\tVAR( %d ) = %d\n", i, varspace[ i ] );
  439.     }
  440. }
  441.  
  442.  
  443. dumpinstr()
  444. {
  445.     long
  446.     i,        /* Loop counter                */
  447.     lastrout;    /* Last routine we've seen        */
  448.     address
  449.     t;
  450.     char
  451.     printone();    /* Routine to print an instruction    */
  452.  
  453.     /* Find which routine this instruction is in */
  454.     lastrout = 0;
  455.     while(    (((long)routspace[ sortedrouts[ lastrout ] ]) <= ((long)bot)) &&
  456.         (((long)lastrout) < ((long)NUMROUT)) )
  457.     lastrout++;
  458.     lastrout--;
  459.  
  460.     /* Print the instructions */
  461.     printf( "ROUTINE %d + %ld:\n", sortedrouts[ lastrout ],
  462.        (long)bot - (long)routspace[ sortedrouts[ lastrout ] ] );
  463.     for( i = bot; i <= top; /* NULL */ ) {
  464.     checkbreak( breaker );
  465.     if( was_signaled )
  466.         return;
  467.     if( ((long)i) >= ((long)routspace[ sortedrouts[ lastrout + 1 ] ]) ) {
  468.         /* We crossed a routine boundary */
  469.         if( lastrout < NUMROUT ) {
  470.         lastrout++;
  471.         printf( "ROUTINE %d:\n", sortedrouts[ lastrout ] );
  472.         }
  473.         else
  474.         return;
  475.     }
  476.     t = i;
  477.     (void)printone( &t );
  478.     i = t;
  479.     }
  480. }
  481.  
  482.  
  483. char
  484. printone( addr )
  485. address
  486.     *addr;
  487. {
  488.     char
  489.     opr, *s;
  490.     address
  491.     num;
  492.     int16
  493.     opnd;
  494.  
  495.     opr = vm_get8( (int32)(*addr), &codetab );
  496.     if( opr & PUSHN ) {
  497.     /* The high order bit is set - this is a PUSH NEG */
  498.     if( opr & 0x7F )
  499.         opnd = 0xFF00 | opr;    /* Perform the sign extension */
  500.     else
  501.         opnd = 0;
  502.     opr = num = 1;
  503.     printf( "\t\t%08d : PUSH     %d\n", *addr, opnd );
  504.     }
  505.     else if( opr & (PUSHARG | PUSHLOCL | CALL) ) {
  506.     switch( opr & (PUSHARG | PUSHLOCL | CALL) ) {
  507.         case PUSHARG  : s = "PUSHARG  "; break;
  508.         case PUSHLOCL : s = "PUSHLOCL "; break;
  509.         case CALL     : s = "CALL     "; break;
  510.     }
  511.     printf( "\t\t%08d : %s%d\n", *addr, s, opr & 0x01F );
  512.     opr = num = 1;
  513.     }
  514.     else if( opr & (PUSHS | JMP | JMPZ) ) {
  515.     switch( opr & (PUSHS | JMP | JMPZ) ) {
  516.         case PUSHS:
  517.         s = "PUSH     ";
  518.         opnd = (opr & 0x07) << 8;
  519.         opnd |= vm_get8( (int32)(*addr + 1), &codetab ) & 0xFF;
  520.         if( opnd > 1023 )
  521.             /* Sign extend the thing */
  522.             opnd = opnd - 2048;
  523.         num = 2;
  524.         break;
  525.         case JMP  :
  526.         s = "JMP      ";
  527.         opnd = vm_get16( (int32)(*addr) + 1, &codetab ) & 0x0FFFF;
  528.         num = 3;
  529.         break;
  530.         case JMPZ :
  531.         s = "JMPZ     ";
  532.         opnd = vm_get16( (int32)(*addr) + 1, &codetab ) & 0x0FFFF;
  533.         num = 3;
  534.         break;
  535.     }
  536.     printf( "\t\t%08d : %s%d\n", *addr, s, opnd );
  537.     opr = 1;
  538.     }
  539.     else {
  540.     switch( opr ) {
  541.         case NOP    : s = "NOP      "; num = 1; break;
  542.         case PUSHME : s = "PUSHME   "; num = 1; break;
  543.         case POP    : s = "POP      "; num = 1; break;
  544.         case RET    : s = "RET      "; num = 1; break;
  545.         case FILEN  : s = "FILEN    "; num = 3; break;
  546.         case LINEN  : s = "LINEN    "; num = 3; break;
  547.         case PUSH   : s = "PUSH     "; num = 3; break;
  548.         default     : s = "ILLEGAL  "; num = 0; opr = -1;
  549.     }
  550.     if( num <= 1 )
  551.         printf( "\t\t%08ld : %s\n", (long) *addr, s );
  552.     else
  553.         printf(    "\t\t%08ld : %s%d\n", (long) *addr, s,
  554.             vm_get16( (int32)(*addr + 1), &codetab ) );
  555.     }
  556.     *addr += num;
  557.     return opr;
  558. }
  559.  
  560.  
  561. dumpstrings()
  562. {
  563.     int16
  564.     i;
  565.  
  566.     for( i = bot; i <= top; i++ ) {
  567.     checkbreak( breaker );
  568.     if( was_signaled )
  569.         return;
  570.     printf( "Virtstr( %d ) = %s\n", i, virtstr( i ) );
  571.     }
  572. }
  573.  
  574.  
  575. dumpnouns()
  576. {
  577.     int16
  578.     i;
  579.  
  580.     fputs( "Nouns:\n", stdout );
  581.     for( i = bot; i <= top; i++ ) {
  582.     checkbreak( breaker );
  583.     if( was_signaled )
  584.         return;
  585.     printf( "\tNOUN %s\n", symtab[ find_sym( NOUN, i ) ].name );
  586.     printf( "\t\tnounspace[ %5d ] = %d\n", i, nounspace[ i ] );
  587.     }
  588. }
  589.  
  590.  
  591. find_sym( t, v )
  592. int
  593.     t;
  594. int16
  595.     v;
  596. {
  597.     int
  598.     i;
  599.  
  600.     for( i = 0; i < NUMSYM; i++ )
  601.     if( symtab[ i ].type == t && symtab[ i ].val == v )
  602.         return i;
  603.     return 0;
  604. }
  605.  
  606.  
  607. dumpobjs()
  608. {
  609.     int16
  610.     i, j, t;
  611.  
  612.     fputs( "Objects:\n", stdout );
  613.     for( i = bot; i <= top; i++ ) {
  614.     checkbreak( breaker );
  615.     if( was_signaled )
  616.         return;
  617.  
  618.     /* Print the object name */
  619.     t = objspace[ i ].adj;
  620.     if( t < 0 )
  621.         /* This modifier is a verb */
  622.         printf(    "\tOBJECT %s %s", symtab[ find_sym( VERB, -t ) ].name,
  623.             symtab[ find_sym( NOUN, objspace[ i ].noun ) ].name );
  624.     else if( t > 0 )
  625.         /* This modifier is an adjective */
  626.         printf(    "\tOBJECT %s %s", symtab[ find_sym( ADJEC, t ) ].name,
  627.             symtab[ find_sym( NOUN, objspace[ i ].noun ) ].name );
  628.     else
  629.         /* This object has no modifier */
  630.         printf( "\tOBJECT %s",
  631.             symtab[ find_sym( NOUN, objspace[ i ].noun ) ].name );
  632.     printf( "\t{val is %d}\n", i );
  633.  
  634.     /* Print the object properties */
  635.     printf( "\t\tLOC        = %d\n", objspace[ i ].loc );
  636.     printf( "\t\tCONT       = %d\n", objspace[ i ].cont );
  637.     printf( "\t\tLINK       = %d\n", objspace[ i ].link );
  638.     printf( "\t\tOTHERS     = %d\n", objspace[ i ].others );
  639.     printf( "\t\tPROPS 1-16 = %04x\n", objspace[ i ].props1to16 );
  640.     for( j = 0; j < _LD - 17; j++ )
  641.         printf( "\t\tPROP[ %d ] = %d\n", j + 17, objspace[i].props[j]);
  642.     printf( "\t\tLDESC      = %d\n", objspace[ i ].props[ _LD - 17] );
  643.     printf( "\t\tSDESC      = %d\n", objspace[ i ].props[ _SD - 17 ] );
  644.     printf( "\t\tACTION     = %d\n",objspace[i].props[ _ACT - 17 ]);
  645.     fputs( "\n", stdout );
  646.     }
  647.     fputs( "\n", stdout );
  648. }
  649.  
  650.  
  651. dumprouts()
  652. {
  653.     address
  654.     j;
  655.     int16
  656.     i;
  657.     char
  658.     t;
  659.  
  660.     fputs( "Routines:\n", stdout );
  661.     for( i = bot; i <= top; i++ ) {
  662.     printf( "\tROUTINE %d:\n", i );
  663.     j = routspace[ i ];
  664.     if( !j )
  665.         fputs( "\t\tNULL\n", stdout );
  666.     else {
  667.         t = printone( &j );
  668.         while( (t != RET) && (t >= 0) ) {
  669.         checkbreak( breaker );
  670.         if( was_signaled )
  671.             return;
  672.         t = printone( &j );
  673.         }
  674.     }
  675.     fputs( "\n", stdout );
  676.     }
  677. }
  678.  
  679.  
  680. dumpverbs()
  681. {
  682.   int16
  683.     i, v;
  684.  
  685.   fputs( "Verbs:\n", stdout );
  686.     for( i = bot; i <= top; i++ ) {
  687.     v = find_sym( VERB, i );
  688.     checkbreak( breaker );
  689.     if( was_signaled )
  690.         return;
  691.     printf( "\tVERB %s; { val is %d }\n", symtab[ v ].name, i );
  692.     printf( "\t\tPREACT = %d\n", verbspace[ i ].preact );
  693.     printf( "\t\tACTION = %d\n", verbspace[ i ].postact );
  694.     fputs( "\n", stdout );
  695.     }
  696.     fputs( "\n", stdout );
  697. }
  698.  
  699.  
  700. dohelp()
  701. {
  702.     puts( "Commands available:" );
  703.     puts( "  a       -- print out all adjectives" );
  704.     puts( "  d       -- print out debugging information" );
  705.     puts( "  g RANGE -- print out globals in RANGE" );
  706.     puts( "  i RANGE -- print out instructions in RANGE" );
  707.     puts( "  m RANGE -- print out virtual strings in RANGE" );
  708.     puts( "  n RANGE -- print out nouns in RANGE" );
  709.     puts( "  o RANGE -- print out objects in RANGE" );
  710.     puts( "  q       -- quit adldebug" );
  711.     puts( "  r RANGE -- print out routines in RANGE" );
  712.     puts( "  s RANGE -- print out symbols in RANGE" );
  713.     puts( "  v RANGE -- print out verbs in RANGE" );
  714.     puts( "  ?       -- print out this list" );
  715.     puts( "\nRANGE is either NUMBER, or NUMBER-NUMBER, where NUMBER" );
  716.     puts( "is either a number or the character '$' (representing the" );
  717.     puts( "largest possible value)." );
  718. }
  719.  
  720. /*** EOF adldebug.c ***/
  721.